/**
 * 
 */
package com.googlecode.eventio.internal.config;

import java.util.concurrent.ThreadFactory;

import com.googlecode.eventio.config.Config;
import com.googlecode.eventio.spi.FailureHandler;
import com.googlecode.eventio.spi.StatisticsImplementor;

/**
 * @author steph
 * 
 */
public class ConfigImpl implements Config {

	private ThreadFactory threadFactory;
	private FailureHandler failureHandler;
	private StatisticsImplementor statisticsImplementor;

	/**
	 * @throws NullPointerException
	 *             - if the specified threadFactory is null
	 */
	@Override
	public void threadFactory(ThreadFactory threadFactory) {
		if (threadFactory == null)
			throw new NullPointerException();

		this.threadFactory = threadFactory;
	}

	public ThreadFactory getThreadFactory() {
		return threadFactory;
	}

	/**
	 * @throws NullPointerException
	 *             - if the specified failureHandler is null
	 */
	@Override
	public void failureHandler(FailureHandler failureHandler) {
		if (failureHandler == null)
			throw new NullPointerException();
		this.failureHandler = failureHandler;
	}

	public FailureHandler getFailureHandler() {
		return failureHandler;
	}

	/**
	 * @throws NullPointerException
	 *             - if the specified statisticsImplementor is null
	 */
	@Override
	public void statistics(StatisticsImplementor statisticsImplementor) {
		if (statisticsImplementor == null)
			throw new NullPointerException();
		this.statisticsImplementor = statisticsImplementor;
	}

	public StatisticsImplementor getStatisticsImplementor() {
		return statisticsImplementor;
	}

}
